/**
 * 
 */
package com.golden.gamedev;

import java.io.Serializable;

/**
 * The {@link NullActionExecutor} class provides the <a
 * href="http://en.wikipedia.org/wiki/Null_object_pattern">Null Object
 * Pattern</a> for the {@link ActionExecutor} interface by specifying an
 * {@link ActionExecutor} that {@link #execute() executes} no action. <br />
 * <br />
 * The {@link NullActionExecutor} class is {@link Serializable} for convenience.
 * 
 * @author MetroidFan2002
 * @version 1.0
 * @since 0.2.4
 * @see ActionExecutor
 * @see Serializable
 * 
 */
public final class NullActionExecutor implements ActionExecutor, Serializable {
	
	/**
	 * {@link Serializable} id generated by Eclipse.
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * The singleton instance of the {@link NullActionExecutor} class.
	 */
	public static final ActionExecutor INSTANCE = new NullActionExecutor();
	
	/**
	 * Creates a new {@link NullActionExecutor} instance, marked private to
	 * avoid instantiation - use {@link #INSTANCE} to retrieve the singleton
	 * instance of the {@link NullActionExecutor} class.
	 */
	private NullActionExecutor() {
		super();
	}
	
	public void execute() {
		// Intentionally blank
	}
	
	/**
	 * Specialized hidden method defined via the {@link Serializable} interface
	 * documentation - reads only the singleton {@link #INSTANCE} from the
	 * bytestream each time a {@link NullActionExecutor} instance is
	 * de-serialized in.
	 * @return Returns the singleton {@link #INSTANCE}.
	 */
	private Object readResolve() {
		return INSTANCE;
	}
	
	/**
	 * Specialized hidden method defined via the {@link Serializable} interface
	 * documentation - writes only the singleton {@link #INSTANCE} to the
	 * bytestream each time a {@link NullActionExecutor} instance is serialized
	 * out.
	 * @return Returns the singleton {@link #INSTANCE}.
	 */
	private Object writeReplace() {
		return INSTANCE;
	}
}
